<script type="text/javascript">
	$(document).ready(function(){
		$('select[name=vitrixh]').change(function(){
			$(this).parent().submit();
		});
		
		
	});	
</script>
<div id="content">
	
	<!-- Box -->
	<div class="box">
		<!-- Box Head -->
		<div class="box-head">
			<h2 class="left">Tin rao</h2>
			<!--<div class="right">
				<label>search articles</label>
				<input type="text" class="field small-field" />
				<input type="submit" class="button" value="search" />
			</div>-->
		</div>
		<!-- End Box Head -->	

		<!-- Table -->
		<div class="table">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<th width="13">STT</th>
					<th><?php echo $this->Paginator->sort('Tiêu đề', 'tieude');?></th>
					<th><?php echo $this->Paginator->sort('Nội dung','noidung');?></th>
					<th><?php echo $this->Paginator->sort('Vị trí xuất hiện','vitrixh');?></th>
					<th><?php echo $this->Paginator->sort('Tên liên hệ','tenlienhe');?></th>
					<th><?php echo $this->Paginator->sort('Số điện thoại','sdtlienhe');?></th>
					<th><?php echo $this->Paginator->sort('Email','email');?></th>
					<th><?php echo $this->Paginator->sort('Thuộc dự án','Duan.tieude');?></th>
					<th><?php echo $this->Paginator->sort('Ngày đăng','ngaydang');?></th>
					<th width="110" class="ac">Điều khiển</th>
				</tr>
				<?php
				$i = 0;
				$dem = 0;
				foreach ($tinraos as $tinrao):
					$class = null;
					if ($i++ % 2 == 0) {
						$class = ' class="altrow"';
					}
					$dem ++;
				?>
				<tr>
					<td><?php echo $dem;?></td>
					<td><h3><a href="#"><?php echo $tinrao['Tinrao']['tieude']; ?></a></h3></td>
					<td><?php echo $tinrao['Tinrao']['noidung']; ?></td>
					<td>
						<form name="changevitrixh" id="changevitrixh" method="post" action="<?php echo $this->webroot;?>tinraos/change_vitrixh">
							<input type="hidden" name="idtinrao" value="<?php echo $tinrao['Tinrao']['id'];?>" />
							<select name="vitrixh">
								<?php
									for($i=1; $i<=10; $i++){
										if($i==$tinrao['Tinrao']['vitrixh']){
											echo '<option selected value="'.$i.'">'.$i.'</option>';
										}else{
											echo '<option value="'.$i.'">'.$i.'</option>';
										}
									}
								?>
								
							</select>
						</form>
					</td>
					<td><?php echo $tinrao['Tinrao']['tenlienhe']; ?></td>
					<td><?php echo $tinrao['Tinrao']['sdtlienhe']; ?></td>
					<td><?php echo $tinrao['Tinrao']['email']; ?></td>
					<td><?php echo $tinrao['Duan']['tieude']; ?></td>
					<td><?php echo $tinrao['Tinrao']['ngaydang']; ?></td>
					<td><?php echo $this->Html->link(__('Delete', true), array('action' => 'admin_delete', $tinrao['Tinrao']['id']), null, sprintf(__('Bạn chắc chắn muốn xóa tin rao này?', true), $tinrao['Tinrao']['id'])); ?><?php echo $this->Html->link(__('Edit', true), array('action' => 'admin_edit', $tinrao['Tinrao']['id'])); ?></td>
				</tr>
				<?php endforeach; ?>
				
			</table>
			
			
			<!-- Pagging -->
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
			 | 	<?php echo $this->Paginator->numbers();?>
		 |
				<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
			<!--<div class="pagging">
				<div class="left">Showing 1-12 of 44</div>
				<div class="right">
					<a href="#">Previous</a>
					<a href="#">1</a>
					<a href="#">2</a>
					<a href="#">3</a>
					<a href="#">4</a>
					<a href="#">245</a>
					<span>...</span>
					<a href="#">Next</a>
					<a href="#">View all</a>
				</div>
			</div>-->
			<!-- End Pagging -->
			
		</div>
		<!-- Table -->
		
	</div>
	<!-- End Box -->
	
	<!-- Box -->
	
	<!-- End Box -->

</div>